@echo off
echo ========================================
echo 项目发布清理脚本
echo ========================================
echo.

set "PROJECT_ROOT=%~dp0.."
cd /d "%PROJECT_ROOT%"

echo 当前目录: %CD%
echo.

echo [1/6] 清理编译产物...
if exist "mcp-server\*.exe" (
    del /q "mcp-server\*.exe"
    echo   已删除: mcp-server\*.exe
)
if exist "mcp-server\dependency-report.json" (
    del /q "mcp-server\dependency-report.json"
    echo   已删除: dependency-report.json
)

echo [2/6] 清理测试结果...
if exist "mcp-server\results" (
    rmdir /s /q "mcp-server\results"
    echo   已删除: mcp-server\results\
)

echo [3/6] 清理测试工具...
if exist "mcp-server\cmd\debug_storage" (
    rmdir /s /q "mcp-server\cmd\debug_storage"
    echo   已删除: mcp-server\cmd\debug_storage\
)
if exist "mcp-server\cmd\search_demo" (
    rmdir /s /q "mcp-server\cmd\search_demo"
    echo   已删除: mcp-server\cmd\search_demo\
)
if exist "mcp-server\cmd\simple_search" (
    rmdir /s /q "mcp-server\cmd\simple_search"
    echo   已删除: mcp-server\cmd\simple_search\
)
if exist "mcp-server\cmd\vectorize_knowledge" (
    rmdir /s /q "mcp-server\cmd\vectorize_knowledge"
    echo   已删除: mcp-server\cmd\vectorize_knowledge\
)
if exist "mcp-server\cmd\vectorize_knowledge_fixed" (
    rmdir /s /q "mcp-server\cmd\vectorize_knowledge_fixed"
    echo   已删除: mcp-server\cmd\vectorize_knowledge_fixed\
)
if exist "mcp-server\cmd\verify_vectors" (
    rmdir /s /q "mcp-server\cmd\verify_vectors"
    echo   已删除: mcp-server\cmd\verify_vectors\
)

echo [4/6] 清理测试脚本...
if exist "mcp-server\analyze_samples.go" (
    del /q "mcp-server\analyze_samples.go"
    echo   已删除: analyze_samples.go
)
if exist "mcp-server\analyze_samples_fixed.go" (
    del /q "mcp-server\analyze_samples_fixed.go"
    echo   已删除: analyze_samples_fixed.go
)
if exist "mcp-server\batch_test_samples.go" (
    del /q "mcp-server\batch_test_samples.go"
    echo   已删除: batch_test_samples.go
)
if exist "mcp-server\test_sample.md" (
    del /q "mcp-server\test_sample.md"
    echo   已删除: test_sample.md
)
if exist "mcp-server\test_splitter.go" (
    del /q "mcp-server\test_splitter.go"
    echo   已删除: test_splitter.go
)
if exist "mcp-server\test_vectors.go" (
    del /q "mcp-server\test_vectors.go"
    echo   已删除: test_vectors.go
)

echo [5/6] 清理示例和演示文件...
if exist "mcp-server\examples" (
    rmdir /s /q "mcp-server\examples"
    echo   已删除: mcp-server\examples\
)
if exist "mcp-server\demo_docs" (
    rmdir /s /q "mcp-server\demo_docs"
    echo   已删除: mcp-server\demo_docs\
)
if exist "mcp-server\scripts" (
    rmdir /s /q "mcp-server\scripts"
    echo   已删除: mcp-server\scripts\
)
if exist "mcp-server\docs" (
    rmdir /s /q "mcp-server\docs"
    echo   已删除: mcp-server\docs\
)

echo [6/6] 清理开发文档...
if exist "mcp-server\IMPLEMENTATION_SUMMARY.md" (
    del /q "mcp-server\IMPLEMENTATION_SUMMARY.md"
    echo   已删除: IMPLEMENTATION_SUMMARY.md
)
if exist "mcp-server\README_VECTOR.md" (
    del /q "mcp-server\README_VECTOR.md"
    echo   已删除: README_VECTOR.md
)
if exist "mcp-server\VECTORIZATION_VERIFICATION_REPORT.md" (
    del /q "mcp-server\VECTORIZATION_VERIFICATION_REPORT.md"
    echo   已删除: VECTORIZATION_VERIFICATION_REPORT.md
)

echo.
echo ========================================
echo 清理完成！
echo ========================================
echo.
echo 已清理的内容:
echo - 编译产物 (*.exe)
echo - 测试结果目录
echo - 测试工具目录
echo - 测试脚本文件
echo - 示例和演示文件
echo - 开发文档
echo.
echo 保留的核心内容:
echo - mcp-server/internal/ (核心模块)
echo - mcp-server/cmd/server/ (主服务)
echo - mcp-server/cmd/text-splitter/ (文本分片工具)
echo - mcp-server/bin/ (编译后的可执行文件)
echo - build/ (构建脚本)
echo - 配置文件和模块定义
echo.

pause